package learningThread.syn.synchronizedMethodLockObj.staticSyn.part1;

public class Service {

    public synchronized static void serviceA(){
        try {
            System.out.println("线程名称:"+Thread.currentThread().getName()+"，在"+System.currentTimeMillis()+"进入serviceA");
            Thread.sleep(3000);
            System.out.println("线程名称:"+Thread.currentThread().getName()+"，在"+System.currentTimeMillis()+"离开serviceA");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public synchronized static void serviceB(){
        System.out.println("线程名称:"+Thread.currentThread().getName()+"，在"+System.currentTimeMillis()+"进入serviceA");
        System.out.println("线程名称:"+Thread.currentThread().getName()+"，在"+System.currentTimeMillis()+"离开serviceA");
    }
}
